<template>
 <div class="steep">
   <div class="card-search cardTop">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="浸渍" name="stepContent"></el-tab-pane>
      <el-tab-pane label="生产计划" name="productionPlan"></el-tab-pane>
      <el-tab-pane label="报表导出" name="reportExport"></el-tab-pane>
    </el-tabs>
   </div>
   <div class="card-table">
    <stepContent v-if="stepContentif" />
    <productionPlan v-if="productionPlanif" />
    <reportExport v-if="reportExportif" />
   </div>
 </div>
</template>

<script>
import stepContent from './tabsSteep/steepContent.vue'
import productionPlan from './tabsSteep/productionPlan.vue'
import reportExport from './tabsSteep/reportExport.vue'
// import '@/mock/dataCenter.js'

export default {
  name: 'test',
  // mixins: [dataCenter],
  components: {
    stepContent,
    productionPlan,
    reportExport
  },
  data () {
    return {
      activeName: 'stepContent',
      stepContentif: true,
      productionPlanif: false,
      reportExportif: false
    }
  },
  computed: {
  },
  created () {
    if (sessionStorage.getItem('activeTab')) {
      this.activeName = sessionStorage.getItem('activeTab')
      console.log('this', this.activeName)
      this.stepContentif = false
      this.productionPlanif = false
      this.reportExportif = false
      switch (sessionStorage.getItem('activeTab')) {
        case 'stepContent':
          this.stepContentif = true
          break
        case 'productionPlan':
          this.productionPlanif = true
          break
        case 'reportExport':
          this.reportExportif = true
          break
        default:
          break
      }
    } else {
      sessionStorage.setItem('activeTab', this.activeName)
    }
  },
  beforeRouteLeave (to, from, next) {
    sessionStorage.removeItem('activeTab')
    next()
  },
  mounted () {
  },
  methods: {
    handleClick (tab) {
      // console.log('tab', tab)
      sessionStorage.setItem('activeTab', tab.name)
      this.stepContentif = false
      this.productionPlanif = false
      this.reportExportif = false
      switch (tab.index) {
        case '0':
          this.stepContentif = true
          break
        case '1':
          this.productionPlanif = true
          break
        case '2':
          this.reportExportif = true
          break
        default:
          break
      }
    }
  }
}
</script>

<style  scoped>
.block{
  margin-top: 20px;
  text-align: right;
}
.steep {
  .cardTop {
    padding: 0 18px 0px;
    .el-tabs__header {
      width: 300px;
    }
  }
.card-table {
    .seachAndState {
      display: flex;
      justify-content: space-between;
      .stateClass {
        display: flex;
        height: 100%;
        padding: 5px 10px 10px 20px;
        width: 200px;
        .greenLight {
          margin: 6px 3px 4px 15px;
          width: 0.7rem;
          height: 0.7rem;
          background-color: rgb(133, 231, 163);
          border-radius: 0.4rem;
          border: 1px solid rgba(41, 241, 101, 0.349);
        }
        .redLight {
          margin: 6px 3px 4px 15px;
          width: 0.7rem;
          height: 0.7rem;
          background-color: rgb(219, 99, 99);
          border-radius: 0.4rem;
          border: 1px solid rgba(241, 148, 41, 0.349);
        }
      }
    }
  }
}
</style>
